xen/arm: Restrict the amount of memory that dom0less domU and dom0 can allocate
authorJulien Grall <jgrall@amazon.com>
Wed, 25 Aug 2021 13:08:29 +0000 (15:08 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 25 Aug 2021 13:08:29 +0000 (15:08 +0200)
commitc439f5e97b0229851ba76249ccb224695a1baa29
tree8da4584822bafc135e804ac6d48ac0cbe593892c
parent66f5e867c6e3d400af354ab72e924fa7b3ada733
xen/arm: Restrict the amount of memory that dom0less domU and dom0 can allocate

Currently, both dom0less domUs and dom0 can allocate an "unlimited"
amount of memory because d->max_pages is set to ~0U.

In particular, the former are meant to be unprivileged. Therefore the
memory they could allocate should be bounded. As the domain are not yet
officially aware of Xen (we don't expose advertise it in the DT, yet
the hypercalls are accessible), they should not need to allocate more
than the initial amount. So cap set d->max_pages directly the amount of
memory we are meant to allocate.

Take the opportunity to also restrict the memory for dom0 as the
domain is direct mapped (e.g. MFN == GFN) and therefore cannot
allocate outside of the pre-allocated region.

This is CVE-2021-28700 / XSA-383.

Reported-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Tested-by: Stefano Stabellini <sstabellini@kernel.org>
master commit: c08d68cd2aacbc7cb56e73ada241bfe4639bbc68
master date: 2021-08-25 14:19:31 +0200
xen/arch/arm/domain_build.c